<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>yizhen 博客</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
        }

        header {
            background-color: #00a6ff;
            padding: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-radius: 0 0 15px 15px;
        }

        .logo {
            color: white;
            font-size: 24px;
            font-weight: bold;
        }

        nav ul {
            list-style: none;
            padding: 0;
        }

        nav ul li {
            display: inline;
            margin: 0 15px;
        }

        nav ul li a {
            color: white;
            text-decoration: none;
        }

        .auth-buttons {
            margin-left: auto;
        }

        .auth-buttons button {
            background-color: white;
            color: #ff8c00;
            border: none;
            border-radius: 5px;
            padding: 10px 15px;
            margin: 0 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .auth-buttons button:hover {
            background-color: #e0e0e0;
        }

        main {
            padding: 20px;
        }

        .banner {
            background-color: #ffde7f;
            border-radius: 10px;
            padding: 20px;
            text-align: center;
        }

        .content {
            margin-top: 20px;
        }

        .post {
            background-color: white;
            border-radius: 10px;
            padding: 15px;
            margin-bottom: 15px;
            border: 1px solid #ddd;
        }

        h2, h3, h4 {
            color: #333;
        }

        /* 模态框样式 */
        .modal {
            display: none; /* 隐藏 */
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5); /* 半透明背景 */
            justify-content: center;
            align-items: center;
        }

        .modal-content {
            background-color: white;
            border-radius: 10px;
            padding: 20px;
            width: 300px;
            text-align: center;
        }

        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }

        .close:hover,
        .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <header>
        <div class="logo">yizhen 博客</div>
        <nav>
            <ul>
                <li><a href="#">首页</a></li>
                <li><a href="#">视频</a></li>
                <li><a href="#">资源</a></li>
            </ul>
        </nav>
        <div class="auth-buttons">
            <button id="login-btn">登录</button>
            <button id="register-btn">注册</button>
        </div>
    </header>
    <main>
        <section class="banner">
            <h2>欢迎来到 yizhen 博客</h2>
            <p>在这里你可以分享的资源、视频、文章等等</p>
        </section>
        <section class="content">
            <h3>最新动态</h3>
        </section>
    </main>

    <!-- 登录模态框 -->
    <div id="loginModal" class="modal">
        <div class="modal-content">
            <span class="close" id="closeLogin">&times;</span>
            <h2>登录</h2>
            <input type="text" placeholder="用户名/手机号/邮箱" /><br><br>
            <input type="password" placeholder="登录密码" /><br><br>
            <button>登录</button>
        </div>
    </div>

    <!-- 注册模态框 -->
    <div id="registerModal" class="modal">
        <div class="modal-content">
            <span class="close" id="closeRegister">&times;</span>
            <h2>注册</h2>
            <input type="text" placeholder="用户名" /><br><br>
            <input type="password" placeholder="密码" /><br><br>
            <button>注册</button>
        </div>
    </div>

    <script>
        // 登录按钮事件
        document.getElementById('login-btn').onclick = function() {
            document.getElementById('loginModal').style.display = 'flex';
        }

        // 注册按钮事件
        document.getElementById('register-btn').onclick = function() {
            document.getElementById('registerModal').style.display = 'flex';
        }

        // 关闭模态框事件
        document.getElementById('closeLogin').onclick = function() {
            document.getElementById('loginModal').style.display = 'none';
        }

        document.getElementById('closeRegister').onclick = function() {
            document.getElementById('registerModal').style.display = 'none';
        }

        // 点击模态框外部关闭模态框
        window.onclick = function(event) {
            if (event.target === document.getElementById('loginModal')) {
                document.getElementById('loginModal').style.display = 'none';
            }
            if (event.target === document.getElementById('registerModal')) {
                document.getElementById('registerModal').style.display = 'none';
            }
        }
    </script>
</body>
</html>
